#lang racket

(define (make-state-f init)
  (lambda (x)
    (let ((old-value init))
      (begin (set! init x)
             old-value))))

(define f (make-state-f 0))